<template name="channelSettings">
	{{#if editing}}
		{{> channelSettingsEditing rid=rid }}
	{{else}}
		{{> channelSettingsInfo}}
	{{/if}}
</template>
<template name="channelSettingsInfo">
	<section class="rc-user-info__scroll{{#if archived}} archived{{/if}}">
		{{# with settings=settings}}
			{{#unless isDirectMessage}}
				<div class="rc-user-info">
					{{#if showAvatar}}
						<div class="rc-user-info__avatar">
							{{#if archived}}
							<div class="rc-user-info__banner">
								{{_ "Room_archived"}}
							</div>
							{{/if}}

							{{> avatar rid=rid}}
						</div>
					{{/if}}
					<h3 title="{{name}}" class="rc-user-info__name">{{> icon block="rc-header__icon" icon=channelIcon}}{{ unscape name}}</h3>
					{{#if password}}
						<label class="rc-user-info__label">
							{{_ "Room_archived"}}
						</label>
					{{/if}}
				</div>
				<label class="rc-user-info__label">
					{{_ "Description"}}
					<div class="rc-user-info__description">
						{{description}}
					</div>
				</label>
			{{/unless}}
			<label class="rc-user-info__label">
				{{_ "Announcement"}}
				<div class="rc-user-info__description">
					{{{RocketChatMarkdown announcement}}}
				</div>
			</label>
			<label class="rc-user-info__label">
				{{_ "Topic"}}
				<div class="rc-user-info__description">
					{{{RocketChatMarkdown topic}}}
				</div>
			</label>
			{{#if broadcast}}
				<label class="rc-user-info__label">
					<b>{{_ "Broadcast_channel"}}:</b> {{_ "Broadcast_channel_Description"}}
				</label>
			{{/if}}
			{{#if hasPurge}}
				<div class="mail-messages__instructions mail-messages__instructions--warning">
					<div class="mail-messages__instructions-wrapper">
						{{> icon block="mail-messages__instructions-icon" icon="warning"}}
						<div class="mail-messages__instructions-text">
							{{#unless filesOnly}}
								{{#unless excludePinned}}
									{{_ "RetentionPolicy_RoomWarning" time=purgeTimeout}}
								{{else}}
									{{_ "RetentionPolicy_RoomWarning_Unpinned" time=purgeTimeout}}
								{{/unless}}
							{{else}}
								{{#unless excludePinned}}
									{{_ "RetentionPolicy_RoomWarning_FilesOnly" time=purgeTimeout}}
								{{else}}
									{{_ "RetentionPolicy_RoomWarning_UnpinnedFilesOnly" time=purgeTimeout}}
								{{/unless}}
							{{/unless}}
						</div>
					</div>
				</div>
			{{/if}}
		{{/with}}
		{{#each channelSettings}}
			<div class="rc-user-info__row">
				{{> Template.dynamic template=template data=data}}
			</div>
		{{/each}}
	</section>

	<div class="rc-user-info__flex rc-user-info__row rc-user-info__room">
		{{#if canEditRoom}}
		<button class="rc-button rc-button--icon rc-button--outline js-edit" type="submit">{{> icon icon='edit'}}{{_ "Edit"}}</button>
		{{/if}}
		<button class="rc-button rc-button--icon rc-button--outline js-hide" type="submit">{{> icon icon='eye-off'}}{{_ "Hide"}}</button>
		{{#if canLeaveRoom}}
		<button class="rc-button rc-button--icon rc-button--outline rc-button--cancel js-leave">{{> icon icon='sign-out'}}{{_ 'Leave'}}</button>
		{{/if}}
	</div>
	{{#if canDeleteRoom}}
	<button class="rc-button rc-button-outline rc-button-cancel js-delete rc-button--cancel rc-button--stack" title="{{_ 'Delete'}}">{{> icon icon='trash'}}{{_ 'Delete'}}</button>
	{{/if}}
</template>
